/**
 * 获取三伏及数九的公历日期
 * @param y int| string 公历年
 * @param p boolean 数九是否取前一年开始
 * 		false: 取参数y的下半年开始的数九
 * @return object  'Y-m-d'=>name
 */
$.dateMoonFate = function(y, p=false){
	const CHS = '一,二,三,四,五,六,七,八,九,出';
	const FMT = function (s){
		let o=new Date(s), y=o.getUTCFullYear()+'-',
			m=o.getUTCMonth()+1, d=o.getUTCDate();
		return y+(m>9?m:'0'+m)+'-'+(d>9?d:'0'+d);
	};
	$.dateMoonFate = function(y, p) {
		let rtn={}, x=$.dateMoonTerm(y,11), s=Date.UTC(x[1],x[2]-1,x[3]);
		x=s/864E5+25540;  x=x%10;  s+=(x?(29-x)*864E5:1728E6);
		rtn[FMT(s)]='初伏';  rtn[FMT(s+864E6)]='中伏';
		x=$.dateMoonTerm(y,14);  s=Date.UTC(x[1],x[2]-1,x[3]);
		x=s/864E5+25540;  x=x%10;  s+=(x?(9-x)*864E5:0);
		rtn[FMT(s)]='末伏';  rtn[FMT(s+864E6)]='出伏';
		x=$.dateMoonTerm(p?y-1:y,23); s=Date.UTC(x[1],x[2]-1,x[3]);
		for(let i=0; i<10; i++){ rtn[FMT(s)]=CHS[i]+'九'; s+=7776E5; }
		return rtn;
	};
	return $.dateMoonFate(y, p);
};
